home *** CD-ROM | disk | FTP | other *** search
/ CU Amiga Super CD-ROM 15 / CU Amiga Magazine's Super CD-ROM 15 (1997)(EMAP Images)(GB)[!][issue 1997-10].iso / CUCD / Programming / crossgcc_linux / m68k-amigaos / include / ix_amiga.h < prev    next >
Encoding:
C/C++ Source or Header  |  1997-03-29  |  5.5 KB  |  172 lines

  1. #ifndef __IX_AMIGA_H
  2. #define __IX_AMIGA_H
  3.  
  4. /* This header provides prototypes for Amiga specific functions and
  5.  * variables available in ixemul.library or libc.a.
  6.  *
  7.  * Each function is also documented in this header (or will be). Sometimes
  8.  * an Amiga extension is described here, but for ease of use the original
  9.  * prototype or macro is defined elsewhere.
  10.  */
  11.  
  12.  
  13. /* This tells you which OS you are running on. */
  14.  
  15. extern int ix_os;
  16.  
  17. #define OS_IS_AMIGAOS   0
  18. #define OS_IS_POS       0x704F5300      /* 'pOS\0' */
  19.  
  20.  
  21. /* This is the name of the program without the path. E.g., if argv[0] is
  22.  * "/ade/bin/cat", then __progname is "cat".
  23.  */
  24.  
  25. extern char *__progname;
  26.  
  27.  
  28. /* This macro can be ORed with the other flags you pass to open(). It will
  29.  * make the open() function case sensitive. This macro is defined in
  30.  * sys/fcntl.h.
  31.  *
  32.  * #define     O_CASE          0x1000
  33.  */
  34.  
  35.  
  36. /* Like vfork(), but the memory that the child allocates will be owned by
  37.  * the child. vfork() uses the parent's memory list, but since vfork2() is
  38.  * used as a fork() emulation, this would be undesirable, not in the least
  39.  * because that memory wouldn't be released until the parent exits. Causing
  40.  * a huge memory leak.
  41.  */
  42.  
  43. int vfork2(void);
  44.  
  45.  
  46. /* Obsolete function to pass pointers to the _ctype_ array and the sys_nerr
  47.  * variable from ixemul to the program. Do not use, use ix_get_vars2()
  48.  * instead.
  49.  *
  50.  * void ix_get_vars(char **ctype, int *_sys_nerr);
  51.  */
  52.  
  53.  
  54. /* This function is used to obtain and set variables from ixemul.library.
  55.  * It is easy to add more variables so it has replaced the old ix_get_vars()
  56.  * function. In general, this is not a function you should call yourself.
  57.  * Only the startup code should use this. If you need to call this
  58.  * function for some reason, I recommend that the ix_get_variables()
  59.  * function from crt0.c is used instead (see below).
  60.  */
  61.  
  62. void ix_get_vars2(int argc, char **ctype, int *_sys_nerr, 
  63.                struct Library **sysbase, struct Library **dosbase,
  64.                FILE ***fpp, char ***environ_out, char ***environ_in,
  65.                int *real_errno, int *real_h_errno, struct __res_state *_res,
  66.                int *_res_socket, int *ExecLib);
  67.  
  68.  
  69. /* A wrapper function for ix_get_vars2(). This is not an ixemul function,
  70.  * but it is part of crt0.c. The single argument should be set to 0.
  71.  */
  72.  
  73. void ix_get_variables(int from_vfork_setup_child);
  74.  
  75.  
  76. /* This is a wrapper intended to make life just a little bit easier for those
  77.  * who need to use the vfork2()/vfork_resume() trick.  It replaces the old
  78.  * 'ix_resident()/ix_get_vars2()' pair.
  79.  */
  80.  
  81. void vfork_setup_child(void);
  82.  
  83.  
  84. /* This is an implementation extension to the `real' vfork2(). Normally you
  85.  * can only cause the parent to resume by calling _exit() or execve() from
  86.  * the child. Since there is no real fork() on the Amiga, this function
  87.  * is a third possibility to make the parent resume. You have then two
  88.  * concurrent processes sharing the same frame and global data. Please be
  89.  * EXTREMELY careful what you may do and what not. vfork2() itself is a hack,
  90.  * this is an even greater one...
  91.  *
  92.  * DO NOT use this function in combination with vfork(), or you'll get a big
  93.  * memory leak. Only use it with vfork2().
  94.  */
  95.  
  96. void vfork_resume(void);
  97.  
  98.  
  99. /* This function will show a requester with the given formatted string as
  100.  * the body text and with one or two buttons. If button1 is NULL, then an
  101.  * Abort button is shown. If button1 is not NULL, but button2 is, then only
  102.  * a single button is shown. The title of the requester is passed in the
  103.  * first argument. If that argument is NULL, then ixemul will use the program
  104.  * name instead. Use this function to show a message in an OS independent
  105.  * fashion.
  106.  *
  107.  * The function returns 0 is button1 is pressed and 1 otherwise.
  108.  *
  109.  * Example: ix_req(NULL, "Abort", NULL, "%s only supports AmigaOS!", __progname);
  110.  * choice = ix_req(NULL, "Abort", "Continue", "Cannot find file %s", filename);
  111.  */
  112.  
  113. int ix_req(char *title, char *button1, char *button2, char *fmt, ...);
  114.  
  115.  
  116. /* Similar to chmod(), but obtains the original Amiga/pOS protection bits.
  117.  * No translation to Unix protection bits has taken place.
  118.  */
  119.  
  120. int achmod(char *name, int mode);
  121.  
  122.  
  123. /* Like select() but you can pass an extra bitmask as the last argument. In
  124.  * that case select() will also wait on these signal bits and return if one of
  125.  * these signals came in. If you want to know which signals arrived, use
  126.  * the new extselect function.
  127.  */
  128.  
  129. int aselect(int nfd, fd_set *ifd, fd_set *ofd, fd_set *efd,
  130.             struct timeval *timeout, long mask);
  131.  
  132.  
  133. /* Like select() but you can pass a pointer to an extra bitmask as the last
  134.  * argument. In that case select() will also wait on these signal bits and
  135.  * return if one of these signals came in. The contents of mask will be set
  136.  * to the signals that arrived.
  137.  */
  138.  
  139. int extselect(int nfd, fd_set *ifd, fd_set *ofd, fd_set *efd,
  140.               struct timeval *timeout, long *mask);
  141.  
  142.  
  143. #if 0
  144. /* TODO */
  145. use geta4 in callbacks installed using funopen() when -resident
  146. SYSTEM_CALL (CreateExtIO, 27)
  147. SYSTEM_CALL (CreatePort, 28)
  148. SYSTEM_CALL (CreateStdIO, 29)
  149. SYSTEM_CALL (CreateTask, 30)
  150. SYSTEM_CALL (DeleteExtIO, 31)
  151. SYSTEM_CALL (DeletePort, 32)
  152. SYSTEM_CALL (DeleteStdIO, 33)
  153. SYSTEM_CALL (DeleteTask, 34)
  154. __amiga_filehandle
  155. ix_resident
  156. ix_geta4
  157. ix_check_cpu
  158. tracecntl
  159. SYSTEM_CALL (ix_get_gmt_offset, 473)
  160. SYSTEM_CALL (ix_set_gmt_offset, 474)
  161. SYSTEM_CALL (ix_get_default_settings, 475)
  162. SYSTEM_CALL (ix_get_settings, 476)
  163. SYSTEM_CALL (ix_set_settings, 477)
  164. SYSTEM_CALL (__init_stk_limit, 480)
  165. SYSTEM_CALL (__stkovf, 481)
  166. SYSTEM_CALL (__stkext, 482)
  167. SYSTEM_CALL (__stkext_f, 483)
  168. SYSTEM_CALL (__stkrst, 484)
  169. #endif
  170.  
  171. #endif
  172.